<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let renderlist = [];
      for (let i = 0; i < 10; i++) {
        renderlist.push({
          id: i,
          position: i * 20
        });
      }
      console.log(renderlist);
      function indexOf(arr, index) {
        console.log(arr, index);
        for (let i = 0; i < arr.length; i++) {
          if (arr[i].id == index) {
            return i;
          } else {
            return -1;
          }
        }
      }
      function updateRenderList(start, end) {
        let arr = [...renderlist];
        // 假如start=1 end 11
        for (let i = 0; i <= 10; i++) {
          let index = indexOf(arr, i);
          if (index > -1) {
            arr.splice(index, 1);
            continue;
          }
        }
        console.log(arr);
      }
      updateRenderList();
    </script>
  </body>
</html>
